package com.java.Enum;

import lombok.extern.slf4j.Slf4j;

/**
 * @Author: ZhangJin
 * @Date: 2020/9/5 17:25
 */
@Slf4j
public enum StoreBuyWay {

    WAY1("1","出租"),
    WAY2("2","转让"),
    NoWAY("3","客户没要求");

    private String Type;
    private String Explain;

    StoreBuyWay(String type, String explain) {
        Type = type;
        Explain = explain;
    }

    public String getType() {
        return Type;
    }

    public String getExplain() {
        return Explain;
    }

    public static StoreBuyWay getWay(String explain) {
        if (explain == null || explain.equals(" ")){
            return NoWAY;
        }
            if (explain.contains(WAY1.getExplain()))
                return WAY1;
            if (explain.contains(WAY2.getExplain()))
                return WAY2;
        return NoWAY;
    }

    public static StoreBuyWay getWayByType(String type) {
        if (!type.equals("")) {
            if (type.contains(WAY1.getType()))
                return WAY1;
            if (type.contains(WAY2.getType()))
                return WAY2;
        }
        return NoWAY;
    }
}
